#!/bin/bash

# 清理并创建根 dist 目录
rm -rf ./dist
mkdir -p ./dist

# 遍历 apps 目录下的所有应用
for app in apps/*; do
  if [ -d "$app" ]; then
    APP_NAME=$(basename "$app")  
    if [ -d "$app/dist" ]; then
      echo "Collecting dist from $APP_NAME..."
      mkdir -p "./dist/$APP_NAME"
      cp -r "$app/dist/"* "./dist/$APP_NAME/"
    fi
  fi
done

echo "All dist files have been collected."